package org.xiao;

import java.io.*;

public class JiaMi {
    public static void main(String[] args) throws IOException {
        File from = new File("D:\\study\\IO\\IOstudy\\src\\main\\resources\\pre.txt");
        File to = new File("D:\\study\\IO\\IOstudy\\src\\main\\resources\\aft.txt");
        jia(from, to, true);
        jia(to, new File("D:\\study\\IO\\IOstudy\\src\\main\\resources\\pre1.txt"), false);
    }
    private static void jia(File from, File to, boolean jia) throws IOException {
        int v = jia ? 100 : -100;
        FileInputStream fis0 = new FileInputStream(from);
        FileOutputStream fis1 = new FileOutputStream(to);
        int x;
        while ((x = fis0.read()) != -1) {
            fis1.write(x + v);
        }
    }
}
